/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../../model/baseModel';
import { UploadApiResult } from '../../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface YfPreRecord extends BasicModel<YfPreRecord> {
  hospCode?: string; // 医院编码
  hospName?: string; // 医疗机构
}

export const yfPreRecordList = (params?: YfPreRecord | any) =>
  defHttp.get<YfPreRecord>({ url: adminPath + '/bus/pre/yfPreRecord/list', params });

export const yfPreRecordListData = (params?: YfPreRecord | any) =>
  defHttp.post<Page<YfPreRecord>>({ url: adminPath + '/bus/pre/yfPreRecord/listData', params });

export const yfPreRecordListPlanData = (params?: YfPreRecord | any) =>
  defHttp.post<Page<YfPreRecord>>({ url: adminPath + '/bus/pre/yfPreRecord/listPlanData', params });

export const yfPreRecordForm = (params?: YfPreRecord | any) =>
  defHttp.get<YfPreRecord>({ url: adminPath + '/bus/pre/yfPreRecord/form', params });

export const yfPreRecordSave = (params?: any, data?: YfPreRecord | any) =>
  defHttp.postJson<YfPreRecord>({ url: adminPath + '/bus/pre/yfPreRecord/save', params, data });

export const updateRouteInfo = (params?: any, data?: YfPreRecord | any) =>
  defHttp.postJson<YfPreRecord>({
    url: adminPath + '/bus/pre/yfPreRecord/updateRouteInfo',
    params,
    data,
  });

export const yfPreRecordImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bus/pre/yfPreRecord/importData',
      onUploadProgress,
    },
    params,
  );

export const yfPreRecordDelete = (params?: YfPreRecord | any) =>
  defHttp.get<YfPreRecord>({ url: adminPath + '/bus/pre/yfPreRecord/delete', params });

export const yfPreRecordBatchRecovery = (params?: YfPreRecord | any) =>
  defHttp.get<YfPreRecord>({ url: adminPath + '/bus/pre/yfPreRecord/batchRecovery', params });
